package com.sales.service.impl;

import com.sales.dao.SalesProductMapper;
import com.sales.service.SalesProductService;
import org.comple.erp.pojo.sales.SalesProduct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.List;

@Service
@Transactional(rollbackFor = RuntimeException.class)
public class SalesProductServiceImpl implements SalesProductService {

    @Autowired
    private SalesProductMapper salesProductMapper;

    @Override
    public Boolean insertSelective(SalesProduct record) {
        if(salesProductMapper.insertSelective(record)>0){
            return true;
        }
        return false;
    }

    @Override
    public List<SalesProduct> selectBySalesProductCode(String code) {
        List<SalesProduct> salesProductlist = salesProductMapper.selectBySalesProductCode(code);
        return salesProductlist;
    }

    @Override
    public Boolean deleteByCode(String salesOrder_code) {
        if(salesProductMapper.deleteByCode(salesOrder_code) > 0){
            return true;
        }
        return false;
    }

    @Override
    public Boolean deleteByCodeLj(String salesOrder_code) {
        if(salesProductMapper.deleteByCodeLj(salesOrder_code) > 0){
            return true;
        }
        return false;
    }
}
